<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="./bootstrap.css">
</head>
<body>
  <div id="app">

    <comment-app></comment-app>
  </div>
  <script src="./vue.js"></script>
  <script>
    /* 
      组件模板必须要根节点

      组件通信应运而生
    */
    const commentApp = {
      template: `
        <div class="container">
          <commentInput></commentInput>
          <commentList></commentList>
        </div>
      `
    }
    const commentInput = {
      template: `
        <div class="commentInput">
          <div class="form-group">
            <input type="text" class="form-control">
          </div>
          <div class="form-group">
            <textarea class="form-control"></textarea>
          </div>
          <div class="form-group clearfix">
            <button class="btn btn-success pull-right">发布</button>
          </div>
        </div>
      `
    }
    const commentList = {
      template: `
        <div class="list-group">
          <commentItem></commentItem>
          <commentItem></commentItem>
          <commentItem></commentItem>
          <commentItem></commentItem>
          <commentItem></commentItem>
          <commentItem></commentItem>

        </div>
      `
    }
    const commentItem = {
      template: `
        <a href="javascript:;" class="list-group-item" >
          <button type="button" class="close"><span>&times;</span></button>
          <h4 class="list-group-item-heading">名字:</h4>
          <p class="list-group-item-text">内容</p>
          <p class="text-muted text-right">2018/11/15</p>
        </a>
      `
    }
    
    Vue.component('commentApp', commentApp)
    Vue.component('commentInput', commentInput)
    Vue.component('commentList', commentList)
    Vue.component('commentItem', commentItem)

    const app = new Vue({
      el: "#app",
      
    })


  </script>
</body>
</html>